import 'package:aichat_flutter_wallet/module/module_wallet/widgets/assets_component/select_chain_list_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:lib_util/lib_util.dart';

import '../../../module_common/provider/wallet_info_provider.dart';
import '../../../module_common/widgets/image/public_image.dart';

// 快，慢，繁忙
enum NewWorkStatus { green, red, warn }

class AssetsChainComp extends StatefulWidget {
  AssetsChainComp({
    super.key,
  });

  @override
  _AssetsChainCompState createState() => _AssetsChainCompState();
}

class _AssetsChainCompState extends State<AssetsChainComp> with SingleTickerProviderStateMixin {
  late AnimationController _controller;

  @override
  void initState() {
    super.initState();

    _controller = AnimationController(
      duration: Duration(milliseconds: 300),
      vsync: this,
    );

  }

  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
    _controller.dispose();
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return InkWell(
      overlayColor: MaterialStateProperty.resolveWith((states) {
        return Colors.transparent;
      }),
      onTap: () {
        final walletInfo = context.read<WalletInfoNotifier>().wallet!;
        Navigator.push(
          context,
          MaterialPageRoute(builder: (context) => SelectChainListPage(wallet: walletInfo),
              settings: RouteSettings(name: '/select_chain_list')),
        );
      },
      child: Container(
        height: 26,
        padding: EdgeInsets.symmetric(vertical: 0, horizontal: 4),
        decoration: BoxDecoration(
            border: Border.all(
              color: Color.fromRGBO(190, 189, 202, 1),
              width: 1.w,
            ),
            borderRadius: BorderRadius.only(
              topLeft: Radius.circular(18.w),
              topRight: Radius.circular(18.w),
              bottomLeft: Radius.circular(18.w),
              bottomRight: Radius.circular(18.w),
            )),
        child:
          Consumer<WalletInfoNotifier>(
            builder: (c,model,_){
              return Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  ClipRRect(
                    borderRadius: BorderRadius.circular(18.w),
                    child: PublicImage(
                      image: model.walletChain!.logo,
                      width: 18.w,
                      height: 18.w,
                    ),
                  ),
                  SizedBox(
                    width: 5.w,
                  ),
                  Text(
                    model.walletChain!.name,
                    style: TextStyle(
                        color: Color.fromRGBO(51, 51, 51, 1), height: 17.w / 12.w, fontWeight: FontWeight.w400, fontSize: 12.sp),
                  ),
                  SizedBox(
                    width: 2.w,
                  ),
                  PublicImage(
                    image: 'assets/images/create_wallet/net_chage.png',
                    width: 12.w,
                    height: 12.w,
                  )
                ],
              );
            },
          )
    ,
      ),
    );
  }
}
